package com.zjp.mapper;

import com.zjp.pojo.IVaccines;
import com.zjp.pojo.IVaccinesExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface IVaccinesMapper {
    long countByExample(IVaccinesExample example);

    int deleteByExample(IVaccinesExample example);

    int deleteByPrimaryKey(Long id);

    int insert(IVaccines record);

    int insertSelective(IVaccines record);

    List<IVaccines> selectByExample(IVaccinesExample example);

    IVaccines selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") IVaccines record, @Param("example") IVaccinesExample example);

    int updateByExample(@Param("record") IVaccines record, @Param("example") IVaccinesExample example);

    int updateByPrimaryKeySelective(IVaccines record);

    int updateByPrimaryKey(IVaccines record);

    /**
     * #接种点疫苗库存加一
     * @param id
     * @return
     */
    @Update("update zjp.i_vaccines set inventory=inventory+1 where id = #{id}")
    int addOne(Long id);

    /**
     * 接种疫苗减一
     *
     * @param ivId
     * @return
     */
    @Update("update zjp.i_vaccines set inventory=inventory-1 where id = #{ivId}")
    int deleteOne(Long ivId);
}